import http from "./request";

// productCategory/list/withChildren
// 查询所有一级分类及子分类
export const proCateListChild = (
  params: CateListChildParams
): PRES<IProCateChiList> => {
  return http.get(`productCategory/list/${params.id}`, { params });
};

// productCategory/delete/{id}
// 删除商品分类
export const productCatDelete = (id: number): PRES<any> => {
  return http.post(`productCategory/delete/${id}`);
};

// productCategory/update/navStatus
// 修改导航栏显示状态
export const proUpdateNavSta = (ids: any, navStatus: any): PRES<any> => {
  return http.post(
    `productCategory/update/navStatus?ids=${ids}&navStatus=${navStatus}`
  );
};

// productCategory/update/showStatus
// 修改显示状态
export const proUpdateShowSta = (ids: any, showStatus: any): PRES<any> => {
  return http.post(
    `productCategory/update/showStatus?ids=${ids}&showStatus=${showStatus}`
  );
};

// 获取筛选的分类
// productAttribute/category/list/withAttr
export const getCategoryList = (): PRES<any> => {
  return http.get(`productAttribute/category/list/withAttr`);
};

// productCategory/create
// 添加产品分类
export const productCategoryCreate = (params: any): PRES<any> => {
  return http.post(`productCategory/create`, params);
};

// productCategory/{id}
// 根据id获取商品分类
export const productCategoryById = (id: number) => {
  return http.get(`productCategory/${id}`);
};

// productCategory/update/{id}
// 修改商品分类
export const productCategoryUpdate = (id: any, params: any): PRES<any> => {
  return http.post(`productCategory/update/${id}`, params);
};
